import { http } from '@/utils/http'
import type { ProcessIOStat } from '@/types/process'

const API_BASE_URL = '/api'

export const getProcessIOStats = async (): Promise<ProcessIOStat[]> => {
  return http.get<ProcessIOStat[]>(`${API_BASE_URL}/process/io`)
}

export const getTopProcessIOStats = async (limit: number = 10): Promise<ProcessIOStat[]> => {
  return http.get<ProcessIOStat[]>(`${API_BASE_URL}/process/io/top?limit=${limit}`)
}

export const getRealTimeProcessIOData = () => {
  return http.createSSE(`${API_BASE_URL}/process/io/realtime`)
}
